#include "pch.h"
#include "PixelBlurDemo.h"
#include "Scene.h"
#include "RendererEngine.h"
#include "renderer.h"
#include "RendererEngine.h"


CPixelBlurDemo::CPixelBlurDemo()
{
	
}

CPixelBlurDemo::~CPixelBlurDemo()
{
	SafeRelease(mpPixelBlurEffect);
}

void CPixelBlurDemo::init(mini::CEngine* pEngine)
{
	auto pRenderer = mini::CRendererEngine::getSinglePtr()->findRenderer(mini::RendererType::FrontRenderer);
	if (nullptr != pRenderer)
	{
		mpPixelBlurEffect = new mini::CPixelBlurEffect();
		pRenderer->addEffect(mpPixelBlurEffect, 0);

		{
			mini::CActor* pAcotor = new mini::CActor;
			pAcotor->initialise("resource/Mesh/cube.txt", "resource/Material/pixelBlur.ma");
			mini::CRenderNode* pRenderNode = pEngine->createRenderNode();
			pRenderNode->bindActor(pAcotor, mini::RendererType::FrontRenderer);
			pEngine->getCurrentScene()->addRenderNode(pRenderNode);
			pAcotor->setPosition(CVector(0, 2, 0));
			mpPixelBlurEffect->addActor(pAcotor);
		}

	}
}
